/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.shop.entity;

import com.thinkgem.jeesite.common.utils.StringUtils;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.DataEntity;

import java.security.Permission;
import java.util.ArrayList;
import java.util.List;

/**
 * 商品信息Entity
 * @author 陈雨乾
 * @version 2019-05-15
 */
public class Product extends DataEntity<Product> {
	
	private static final long serialVersionUID = 1L;
	private String id;
	private String name;		// 商品名称
	private String price;		// 商品价格
	private String brand;		// 商品品牌
	private String sellshop;		// 店铺名称
	private String img;		// 商品图片
	private String keyword;		// 关键字
	private String stock;		// 库存
	private String detalls;		// 详情介绍
	private Cate category;		// 类别类型
	private List<String> imgList;// 图片数组

	@Override
	public String getId() {
		return id;
	}

	@Override
	public void setId(String id) {
		this.id = id;
	}

	private String  bool;		//是否被当前登录用户收藏

	public String getBool() {
		return bool;
	}

	public void setBool(String bool) {
		this.bool = bool;
	}

	public Product() {
		super();
	}

	public Product(String id){
		super(id);
	}

	@Length(min=0, max=255, message="商品名称长度必须介于 0 和 255 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}
	
	@Length(min=0, max=255, message="商品品牌长度必须介于 0 和 255 之间")
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}
	
	@Length(min=0, max=255, message="店铺名称长度必须介于 0 和 255 之间")
	public String getSellshop() {
		return sellshop;
	}

	public void setSellshop(String sellshop) {
		this.sellshop = sellshop;
	}
	

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}
	
	@Length(min=0, max=255, message="关键字长度必须介于 0 和 255 之间")
	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
	
	@Length(min=0, max=255, message="库存长度必须介于 0 和 255 之间")
	public String getStock() {
		return stock;
	}

	public void setStock(String stock) {
		this.stock = stock;
	}
	
	public String getDetalls() {
		return detalls;
	}

	public void setDetalls(String detalls) {
		this.detalls = detalls;
	}

	public Cate getCategory() {
		return category;
	}

	public void setCategory(Cate category) {
		this.category = category;
	}

	public List<String> getImgList() {
		if(StringUtils.isNotEmpty(img)){
			String[] strs=img.split("\\|");
			imgList = new ArrayList<String>();
			for (String s:strs) {
				imgList.add(s);
			}
		}else {
			imgList= new ArrayList<String>();
		}
		return imgList;
	}

	public void setImgList(List<String> imgList) {
		this.imgList = imgList;
	}
}